<?php
include 'conn_mysql.php';


echo '功能已屏蔽_hidden';exit;
$id=$_REQUEST['id'];
$id_difang=$_REQUEST['id_difang'];
//查询申请人用户信息
$sql="select * from main_user where id_self='".$id."'";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)){
	$id=$row['id_self'];
	$name=$row['name'];
	$phone=$row['phone'];
	$idcode=$row['idcode'];
	$choose=$row['choose'];
	$textarea=$row['textarea'];
	$checkbox=$row['checkbox'];
	$num=$row['num'];
	$banqi=$row['banqi'];
}
//查询地方信息
$sql="SELECT * FROM `lvyou_difang_info` WHERE id='".$id_difang."'";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)){
	$difang_name=$row['difang_name'];
	$biaoti=$row['biaoti'];
	$jitian=$row['jitian'];
	$fanduos=$row['fanduos'];
	$picture_lujing=$row['picture_lujing'];
	$danfangcha=$row['danfangcha'];
	if($banqi==0){
		$banqi=1;
	}
	if($banqi==1){
		$chengren=$row['chengren1'];
		$ertong=$row['ertong1'];
	}
	if($banqi==2){
		$chengren=$row['chengren2'];
		$ertong=$row['ertong2'];
	}
	if($banqi==3){
		$chengren=$row['chengren3'];
		$ertong=$row['ertong3'];
	}
}
$monkey=0;


?>

<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, maximum-scale=1, user-scalable=no">
    <title>驴行天下</title>
    <link href="bootstrap.min.css" rel="stylesheet">
    <link href="style.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<!--header-->
<div class="header_title">
	<!--<p>【贵州精华】2016全年贵州：西江千户苗寨-朗德上寨-荔波小七孔-黄果树瀑布-青岩古镇，奇山秀水、苗家风情之旅6日团</p>-->
	<p><?php echo $biaoti;?></p><!--旅游项目标题-->
</div>
<!--plate-->
<div class="plate">
	<h1>订单详情</h1>
	<div class="plate_detail">
    	<div><h1>姓&nbsp;&nbsp;&nbsp;&nbsp;名：</h1><h2><?php echo $name;?>&nbsp;&nbsp;
		<?php 
		if($choose==1){
			echo "男成人";
			$jiage=$chengren;
		}
		if($choose==2){
			echo "女成人";
			$jiage=$chengren;
		}
		if($choose==3){
			echo "儿童";
			$jiage=$ertong;
		}
		?></h2></div>
    </div>
    <div class="plate_detail">
    	<div><h1>手机号：</h1><h2><?php echo $phone;?></h2></div>
    </div>
    <div class="plate_detail">
    	<div><h1>身份证：</h1><h3><?php echo $idcode;?></h3></div>
    </div>
    <div class="plate_detail">
    	<div><h1>费&nbsp;&nbsp;&nbsp;&nbsp;用：</h1><h2><?php echo $jiage;?>.00&nbsp;元</h2><a href="xiugei_mian.php?id=<?php echo $id;?>&id_difang=<?php echo $id_difang;?>" class="plate_change">修改</a></div>
    </div>
<?php $monkey=$jiage*1?>	
	
	<?php
	//读取随行用户信息
	$sql="select * from fu_user where id='".$id."'";
	$query = mysql_query($sql);
	while($row = mysql_fetch_array($query)){
	?>
		<div class="line_short"></div>
		<div class="plate_detail">
			<div><h1>姓&nbsp;&nbsp;&nbsp;&nbsp;名：</h1><h2><?php echo $row['name'];?>&nbsp;&nbsp;
			<?php 
			if($row['choose']==1){
				echo "男成人";
				$jiage=$chengren;
			}
			if($row['choose']==2){
				echo "女成人";
				$jiage=$chengren;
			}
			if($row['choose']==3){
				echo "儿童";
				$jiage=$ertong;
			}
			?></h2></div>
		</div>
		<div class="plate_detail">
			<div><h1>手机号：</h1><h2><?php echo $row['phone'];?></h2></div>
		</div>
		<div class="plate_detail">
			<div><h1>身份证：</h1><h3><?php echo $row['idcode'];?></h3></div>
		</div>
		<div class="plate_detail">
			<div><h1>费&nbsp;&nbsp;&nbsp;&nbsp;用：</h1><h2><?php echo $jiage;?>.00&nbsp;元</h2>
				<a href="" class="plate_change" onClick="del_suixingyouke('<?php echo $row['id_fu'];?>');">删除</a>
				<a href="add.php?id=<?php echo $id;?>&id_fu=<?php echo $row['id_fu'];?>&id_difang=<?php echo $id_difang;?>" class="plate_change">修改</a>
			</div>
		</div>
	<?php $monkey=$jiage*mysql_num_rows($query)+$monkey;} ?>
	<div class="line_short"></div>
	<a><div class="plate_line_add" onClick="window.location.href='add.php?id=<?php echo $id;?>&id_difang=<?php echo $id_difang;?>'"><div>+</div><h2>添加游客</h2></div></a>
	

	<div class="line_short"></div>
    <div class="plate_detail">
    	<div><h4>全程单房差：</h4><h2>
		<?php
		if($num==0){
			echo 0;
		}else{
			echo $danfangcha.".00*$num";
			$monkey=$monkey+$danfangcha*$num;
		}
		?>
		</h2><a href="xiugeidanfangcha.php?id=<?php echo $id;?>&id_difang=<?php echo $id_difang;?>" class="plate_change">修改</a></div>
    </div>
	<div class="line_short"></div>
	
	
    <div class="plate_detail">
    	<div><h4>备注：</h4><h2><?php echo $textarea;?></h2><a href="xiugei_mian.php?id=<?php echo $id;?>&id_difang=<?php echo $id_difang;?>" class="plate_change">修改</a></div>
    </div>
		
    <div class="line_short"></div>
    <div class="plate_detail" id="plate_detail">
    	<div><h1>结&nbsp;&nbsp;&nbsp;&nbsp;算：</h1><h2><?php echo $monkey;?>&nbsp;元</h2></div>
    </div>
</div>
<?php
//判断该笔订单是否支付成功
$num_dingdan=0;
$sql="SELECT * FROM `dingdan` WHERE phone='$phone'";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)){
	$out_trade_no=$row['out_trade_no'];
	$sql1="SELECT * FROM `zhifu_info` WHERE out_trade_no='$out_trade_no' and money='$monkey'";
	$query1 = mysql_query($sql1);
	if(mysql_num_rows($query1)>0){
		$num_dingdan=$num_dingdan+1;
	}
}
if($num_dingdan==0){//未支付
?>
<div class="button"><input type="submit" value="支&nbsp;&nbsp;付" onClick="pay();"></div>
<?php }else{//已支付?>
<div class="button"><input type="submit" value="已支付"></div>
<?php }?>
</body>
<script>
function intOnly(){
  var codeNum=event.keyCode;
  if(codeNum==8||codeNum==37||codeNum==39||(codeNum>=48&&codeNum<=57)){
    event.returnValue=codeNum;
  }else{
    event.returnValue=false;
  }
}

function del_suixingyouke(id_fu){
	var url="getmessage_all.php?bigtype=3";
	url=url+"&id_fu="+id_fu;
	url=url+"&id=<?php echo $_REQUEST['id'];?>";

	$.ajax({
		type:"GET",
		url:url,
		dataType: "json",
		success: function(data){	
			if(data['code']==0001){
				window.location.href='pay.php?id='+data['id'];
			}else{
				
			}
		},
		error:function(){
		}
	});
}
<?php
//组装描述字符串
$miaoshu=$biaoti;//暂时使用旅游地方标题
?>
//支付
function pay(){
	window.location.href='PHP/demo/js_api_call.php?monkey=<? echo $monkey*100;?>&miaoshu=<?php echo $miaoshu;?>&phone=<?php echo $phone;?>&id_difang=<?php echo $id_difang;?>';
	//window.location.href='PHP/demo/js_api_call.php?monkey=<?php echo 1;?>&miaoshu=<?php echo $miaoshu;?>&phone=<?php echo $phone;?>&id_difang=<?php echo $id_difang;?>';
}
</script>
</html>



